package flight.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import flight.view.IntFlight;
import flight.view.ManagerFlight;

import java.awt.Color;
import java.awt.Container;

import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;

public class Main extends JFrame {

	protected static Container desktopPane = null;
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Main frame = new Main();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Main() {
		setBackground(Color.WHITE);
		setTitle("\u822A\u73ED\u4FE1\u606F\u67E5\u8BE2\u53CA\u51FA\u884C\u89C4\u5212\u7CFB\u7EDF");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 1302, 735);
		setLocationRelativeTo(null);
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu menu = new JMenu("\u6570\u636E\u7BA1\u7406");
		menuBar.add(menu);
		
		JMenuItem menuItem = new JMenuItem("\u8F93\u5165\u6570\u636E");
		menuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				IntFlight intflightview=new IntFlight();
				intflightview.setVisible(true);
				desktopPane.add(intflightview);
			}
		});
		menu.add(menuItem);
		
		JMenuItem mu_find = new JMenuItem("\u67E5\u8BE2");
		mu_find.setIcon(new ImageIcon("C:\\Users\\\u65E0\u89DE\u72EC\u8BED\\Desktop\\012\\png\\24x24\\001_20.png"));
		mu_find.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ManagerFlight findview=new ManagerFlight();
				findview.setVisible(true);
				desktopPane.add(findview);
				
			}
		});
		menu.add(mu_find);
		
		JMenuItem mu_exit = new JMenuItem("\u9000\u51FA");
		mu_exit.setIcon(new ImageIcon("C:\\Users\\\u65E0\u89DE\u72EC\u8BED\\Desktop\\012\\png\\24x24\\001_05.png"));
		mu_exit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
				System.exit(0);
			}
		});
		menu.add(mu_exit);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		desktopPane  = new JDesktopPane();
		desktopPane.setBounds(10, 10, 1284, 670);
		contentPane.add(desktopPane);
	}
}
